
import numpy as np
import networkx as nx

def graph_from_adjmat_file(filename):
	with open(filename) as f:
		adj_matrix = np.loadtxt(f)
	graph = nx.from_numpy_matrix(adj_matrix, create_using=nx.DiGraph())
	return graph

def file2graph(infile):
	adj_matrix = np.loadtxt(infile)
	graph = nx.from_numpy_matrix(adj_matrix, create_using=nx.DiGraph())
	return graph
